import { FilterConst } from "../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { TweenMax } from "../../../../com/greensock/TweenMax";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
type int = number;
//class IssmNoticItem
    
    export  class IssmNoticItem /* flash.display.Sprite */
    {
        constructor()
        {
            
            mouseEnabled = false;
            mouseChildren = false;
            this._textField = new Object /* flash.text.TextField */();
            this._textField.selectable = false;
            this._textField.multiline = true;
            this._textField.wordWrap = true;
            this._textField.width = 500;
            this._textField.filters = [FilterConst.nameGlowFilter];
            var loc1=new GTextFormat("", 14, 16776960, true, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._textField.defaultTextFormat = loc1;
            this._textField.autoSize = flash.text.TextFieldAutoSize.CENTER;
            addChild(this._textField);
            return;
        }

        /* internal  */onInEnd(): void
        {
            this._timerKey = flash.utils.setTimeout(this.timerOutHandler, 60000);
            return;
        }

        /* internal  */onOutEnd(): void
        {
            if (this._endFun != null) 
            {
                this._endFun.call(this, this);
            }
            return;
        }

        /* internal  */timerOutHandler(): void
        {
            this._outTween = TweenMax.to(this._textField, 0.3, {"alpha": 0, "onComplete": this.onOutEnd});
            return;
        }

        public updateData(arg1: string, arg2: Function=null, arg3: Boolean=true): void
        {
            this._textField.htmlText = HTMLUtil.addColor(arg1, "#ffff00");
            this._textField.height = this._textField.textHeight;
            if (arg3) 
            {
                this._textField.alpha = 0;
                this._textField.y = 20;
                this._inTween = TweenMax.to(this._textField, 0.3, {"alpha": 1, "y": 0, "onComplete": this.onInEnd});
            }
            else 
            {
                this._textField.alpha = 1;
                this._textField.y = 0;
                this.onInEnd();
            }
            return;
        }

        public killInEase(): void
        {
            if (this._inTween && this._inTween.active) 
            {
                this._textField.y = 0;
                this._textField.alpha = 1;
                this._inTween.kill();
                this.onInEnd();
            }
            return;
        }

        public dispose(): void
        {
            this._endFun = null;
            flash.utils.clearTimeout(this._timerKey);
            if (this._inTween && this._inTween.active) 
            {
                this._inTween.kill();
            }
            else if (this._outTween && this._outTween.active) 
            {
                this._outTween.kill();
            }
            this._textField.alpha = 1;
            this._textField.y = 0;
            return;
        }

        public /* override */ get height(): number
        {
            return this._textField.textHeight;
        }

        public /* override */ get width(): number
        {
            return this._textField.width;
        }

        /* internal */ /* var */_textField: Object /* flash.text.TextField */;

        /* internal */ /* var */_timerKey: int;

        /* internal */ /* var */_inTween: TweenMax;

        /* internal */ /* var */_outTween: TweenMax;

        /* internal */ /* var */_endFun: Function;
    }
